#include <Windows.h>

int WINAPI WinMain(
    HINSTANCE hinst,
    HINSTANCE hinstPrev,
    LPWSTR szCmdLine,
    int iCmdShow
)
{
    PROCESS_INFORMATION pi;

    RETAILMSG(1, (TEXT("LaunchCoreCon: Starting...\r\n")));
    if (CreateProcess( TEXT("ConmanClient2.exe"), TEXT(""), NULL, NULL, FALSE, 0,NULL, NULL, NULL, &pi))
    {
        CloseHandle(pi.hProcess);
        CloseHandle(pi.hThread);
        RETAILMSG(1, (TEXT("LaunchCoreCon: ConmanClient2.exe started\r\n")));
    }
    else
    {
        RETAILMSG(1, (TEXT("LaunchCoreCon: Failed to start ConmanClient2.exe: %d\r\n"), GetLastError()));
    }
    if (CreateProcess( TEXT("CMAccept.exe"), TEXT(""), NULL, NULL, FALSE, 0,NULL, NULL, NULL, &pi))
    {
        CloseHandle(pi.hProcess);
        CloseHandle(pi.hThread);
        RETAILMSG(1, (TEXT("LaunchCoreCon: CMAccept.exe started\r\n")));
    }
    else
    {
        RETAILMSG(1, (TEXT("LaunchCoreCon: Failed to start CMAccept.exe: %d\r\n"), GetLastError()));
    }
    SignalStarted( _wtol(szCmdLine) );
    RETAILMSG(1, (TEXT("LaunchCoreCon: Exitting...\r\n")));
    return 0;
}

